// 成员函数做友元
#include <iostream>
#include <string>
using namespace std;
class Building;
class GoodFriend
{
public:
    Building *building;
    GoodFriend();
    void visit1();
    void visit2();
};

class Building
{
    friend void GoodFriend::visit2();

private:
    string m_bedRoom;

public:
    string m_sittingRoom;
    Building();
};
GoodFriend::GoodFriend()
{
    building = new Building;
}
void GoodFriend::visit1()
{
    cout << "visit sittingRoom: " << building->m_sittingRoom << endl;
}
void GoodFriend::visit2()
{
    cout << "visit sittingRoom:" << building->m_sittingRoom << endl;
    cout << "visit bedRoom:" << building->m_bedRoom << endl;
}
Building::Building()
{
    this->m_bedRoom = "bedRoom";
    this->m_sittingRoom = "sittingRoom";
}
void test1()
{
}
int main(void)
{
    test1();

    return 0;
}